//
//  HWReadHabitResetViewController.m
//  嗨文
//
//  Created by 响当当 on 5/7/19.
//  Copyright © 2019 dongzheng. All rights reserved.
//

#import "HWReadHabitResetViewController.h"
#import "HWReadHabitView.h"

@interface HWReadHabitResetViewController ()
@property (nonatomic, strong)HWReadHabitView *readHabbitView;//阅读爱好
@end

@implementation HWReadHabitResetViewController
- (HWReadHabitView *)readHabbitView
{
    if (!_readHabbitView)
    {
        _readHabbitView = [[HWReadHabitView alloc]initWithFrame:CGRectMake(0,TABBAR_HEIGHT,SCREEN_WIDTH,SCREEN_HEIGHT - TABBAR_HEIGHT - NAVIBAR_HEIGHT)];
        
        WeakSelf(self)
        _readHabbitView.getBackSaveHabbitBlock = ^{
            [weakSelf.navigationController popViewControllerAnimated:YES];
        };
    }
    return _readHabbitView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitle:@"阅读口味"];
    [self setDefaultNav];
    
    [self getBoyHabit];
    [self getGirlHabit];
    
    [self.view addSubview:self.readHabbitView];
}


- (void)getBoyHabit
{
    NSDictionary *prarmers = @{
                               @"access_token" : current_User.token,
                               @"channel" : @"1"
                               };
    
    WeakSelf(self)
    [NetWorkingManager postRequestUrl:FULL_WEB_URL(KAPI_BOYHABITLIST) withPramater:prarmers sucess:^(id responseObject) {
        [weakSelf.readHabbitView getBoyHabitList:responseObject[@"data"]];
    } failure:^(NSError *error) {
        
    }];
}

- (void)getGirlHabit
{
    NSDictionary *prarmers = @{
                               @"access_token" : current_User.token,
                               @"channel" : @"0"
                               };
    
    WeakSelf(self)
    [NetWorkingManager postRequestUrl:FULL_WEB_URL(KAPI_BOYHABITLIST) withPramater:prarmers sucess:^(id responseObject) {
        [weakSelf.readHabbitView getGirlHabitList:responseObject[@"data"]];
    } failure:^(NSError *error) {
        
    }];
}
@end
